<%@ include file="/other/Header.jsp"%>
<jsp:directive.page import="java.sql.*" />
<jsp:directive.page import="Connectivity.ConnectionManager" />
<%
String path1 = "/container/images/";
String basePath1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path1+"/";
 %>
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'EmpListReport.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>
<body>
	<table border=1 width=80%>
		<tr>
			<td colspan=6><center>
					<b>EMPLOYEE DETAILS</b>
				</center></td>

		</tr>
		<tr>
			<td colspan=1><font size=2><b>EMP ID</b></font></td>
			<td colspan=1><font size=2><b>NAME</b></font></td>
			<td colspan=1><font size=2><b>CELL NO</b></font></td>
			<td colspan=1><font size=2><b>BIRTH DATE</b></font></td>
			<td colspan=2><font size=2><b>IMAGE</b></font></td>
		</tr>

		<%
   String emp_eid=null,full_name=null,mobile_no=null,birth_date=null,image_name=null,jdate=null,experience=null;
   String gender="",fname="",mname="",last_name="",role_eid="";
   String emplist="select emp_id,sex as gender,name,father_name,last_name,";
   emplist=emplist+"mobile_no,birth_date,image_name,role_id,date_of_joining,age(date_of_joining) as experience from employee_master where role_id!=1 and status='V' order by emp_id";
   PreparedStatement empprst=con.prepareStatement(emplist);
   ResultSet emprs=empprst.executeQuery(); 
   while(emprs.next())
   {
    emp_eid=emprs.getString(1);
    String link="<a href='/Genius/form/employee/UpdateEmp.jsp'>";
    gender=emprs.getString(2);
    fname=emprs.getString(3);
    mname=emprs.getString(4);
    last_name=emprs.getString(5);
    if(gender.equalsIgnoreCase("M")){full_name="Mr.";}else {full_name="Smt. ";}
     
    full_name=full_name+" "+fname+" "+last_name;
    mobile_no=emprs.getString(6);
    birth_date=emprs.getString(7);
    image_name=emprs.getString(8);
    role_eid = emprs.getString(9);
    jdate = emprs.getString(10);
    experience =emprs.getString(11);
    
    session.setAttribute("emp_id",emp_eid);
	session.setAttribute("fname",fname);
	session.setAttribute("mname",mname);
	session.setAttribute("lname",last_name);
	session.setAttribute("cellnumber",mobile_no);
	session.setAttribute("bdate",birth_date);
	session.setAttribute("image_name",image_name);
	session.setAttribute("role_eid",role_eid);
    session.setAttribute("gender", gender);
    session.setAttribute("jdate", jdate);
    session.setAttribute("experience", experience);
    %>
		<tr>
			<td colspan=1><%=link%><%=emp_eid %></a></td>
			<td colspan=1><%=link%><%=full_name%></a></td>
			<td colspan=1><%=link%><%=mobile_no%></a></td>
			<td colspan=1><%=link%><%=birth_date%></a></td>
			<td colspan=2><%=link%><image src='<%=(basePath1+image_name)%>'
					width=50 height=50>
				</a></td>
		</tr>


 
		<input type=hidden name=emp_id value='<%=emp_id %>'>
		<input type=hidden name=fname value='<%=fname %>'>
		<input type=hidden name=mname value='<%=mname %>'>
		<input type=hidden name=lname value='<%=last_name %>'>
		<input type=hidden name=cellnumber value='<%=mobile_no %>'>
		<input type=hidden name=bdate value='<%=birth_date %>'>
		<input type=hidden name=image_name value='<%=image_name %>'>


		<%
    

    
    
    
    }
   %>
	</table>


</body>
</html>
